if (temp)
{
- printf ("<td class='cell'><a onmouseover='show(\"detail_%p\");' \
- onmouseout='hide(\"detail_%p\");' \
- href='javascript:tick()'>%s</a></td>",
- temp, temp, utf8_bar[temp->fish_path.conversions]);
+ printf ("<td class='cell'><a href='javascript:o()'>%s",
+ utf8_bar[temp->fish_path.conversions]);
total_length += temp->fish_path.conversions;
total_cost += temp->fish_path.cost;
+
+ {
+ int i;
+ printf ("<div class='tooltip'>");
+ printf ("<h3><span class='g'>path</span> %s <span class='g'>to</span> %s</h3>", source->instance.name, destination->instance.name);
+ printf ("<table>\n");
+
+ printf ("<tr>");
+ printf ("<td><em>conversion</em></td>");
+ printf ("<td style='text-align:right'><em>cost</em></td>");
+ printf ("</tr>");
+
+ for (i=0; i< temp->fish_path.conversions; i++)
+ {
+ printf ("<tr>");
+ printf ("<td>%s</td>", BABL(temp->fish_path.conversion[i])->instance.name);
+ printf ("<td class='r'>%i</td>", BABL(temp->fish_path.conversion[i])->conversion.cost);
+ printf ("</tr>");
+ }
+
+ printf ("<tr>");
+ printf ("<td><em>total</em></td>");
+ printf ("<td class='r'><em>%3.0f</em></td>", temp->fish_path.cost);
+ printf ("</tr>");
+ printf ("</table>\n");
+ printf ("</div>\n");
+ }
+ printf ("</a></td>");
ok ++;
total ++;
}
else
{
- printf ("<td class='cell'><a onmouseover='show(\"detail_%p_%p\");' \
- onmouseout='hide(\"detail_%p_%p\");' \
- href='javascript:tick()'>%s</a></td>",
- source, destination,
- source, destination,
- " ");
+ printf ("<td class='cell'><a href='javascript:o()'>%s", " ");
+ {
+ printf ("<div class='tooltip'>");
+ printf ("<h3><span class='g'>Reference</span> %s <span class='g'>to</span> %s</h3>", source->instance.name, destination->instance.name);
+ printf ("</div>\n");
+ }
+ printf ("</a></td>");
}
}
return 0;
}
printf ("<tr>");
- printf ("<td class='format_name'><a onmouseover='show(\"format_%p\");' \
- onmouseout='hide(\"format_%p\");' \
- href='javascript:tick();'>%s</a></td>",
- babl, babl, expanded_name);
+ printf ("<td class='format_name'><a href='javascript:o();'>%s", expanded_name);
+ {
+ int i;
+
+ printf ("<div class='tooltip' id='format_%p'>", babl);
+ printf ("<h3>%s</h3>", babl->instance.name);
+
+ printf ("<dl>");
+ printf ("<dt>bytes/pixel</dt><dd>%i</dd>", babl->format.bytes_per_pixel);
+ printf ("<dt>model</dt><dd>%s</dd>", BABL(babl->format.model)->instance.name );
+ printf ("<dt>loss</dt><dd>%f</dd>", babl->format.loss );
+ printf ("<dt>components</dt><dd><table class='nopad'>");
+
+ for (i=0; i< babl->format.components; i++)
+ {
+ printf ("<tr><td class='type'>%s</td><td class='component'>%s</td></tr>",
+ BABL(babl->format.type[i])->instance.name,
+ BABL(babl->format.component[i])->instance.name );
+ }
+ printf ("</table></dd></dl>");
+
+ printf ("</div>\n");
+ }
+
+ printf ("</a></td>");
babl_format_each (table_destination_each, babl);
printf ("</tr>\n");
source_no++;
return 0;
}
-
-
-static int
-detail_destination_each (Babl *babl,
- void *userdata)
-{
- Babl *source = userdata;
- Babl *destination = babl;
-
- Babl *temp = babl_fish_path (source, destination);
-
- if (temp)
- {
- int i;
- printf ("<div class='detail' style='display:none' id='detail_%p'>", temp);
- printf ("<h3><span style='color:gray'>path</span> %s <span style='color:gray'>to</span> %s</h3>", source->instance.name, destination->instance.name);
- printf ("<table>\n");
- printf ("<tr>");
- printf ("<td><em>conversion</em></td>");
- printf ("<td style='text-align:right'><em>cost</em></td>");
- printf ("</tr>");
- for (i=0; i< temp->fish_path.conversions; i++)
- {
- printf ("<tr>");
- printf ("<td>%s</td>", BABL(temp->fish_path.conversion[i])->instance.name);
- printf ("<td style='text-align:right'>%i</td>", BABL(temp->fish_path.conversion[i])->conversion.cost);
- printf ("</tr>");
- }
- printf ("<tr>");
- printf ("<td><em>total</em></td>");
- printf ("<td style='text-align:right'><em>%3.0f</em></td>", temp->fish_path.cost);
- printf ("</tr>");
- printf ("</table>\n");
- printf ("</div>\n");
- }
- else
- {
- printf ("<div class='detail' style='display:none' id='detail_%p_%p'>", source, destination);
- printf ("<h3><span style='color:gray'>Reference</span> %s <span style='color:gray'>to</span> %s</h3>", source->instance.name, destination->instance.name);
- printf ("</div>\n");
- }
- return 0;
-}
-
-static int
-detail_source_each (Babl *babl,
- void *userdata)
-{
- babl_format_each (detail_destination_each, babl);
- return 0;
-}
-
-static int
-format_each (Babl *babl,
- void *userdata)
-{
- int i;
-
- printf ("<div class='detail' style='display:none' id='format_%p'>", babl);
- printf ("<h3>%s</h3>", babl->instance.name);
-
- printf ("<dl>");
- printf ("<dt>bytes/pixel</dt><dd>%i</dd>", babl->format.bytes_per_pixel);
- printf ("<dt>model</dt><dd>%s</dd>", BABL(babl->format.model)->instance.name );
- printf ("<dt>loss</dt><dd>%f</dd>", babl->format.loss );
- printf ("<dt>components</dt><dd><table class='nopad'>");
-
- for (i=0; i< babl->format.components; i++)
- {
- printf ("<tr><td class='type'>%s</td><td class='component'>%s</td></tr>",
- BABL(babl->format.type[i])->instance.name,
- BABL(babl->format.component[i])->instance.name );
- }
- printf ("</table></dd></dl>");
-
- printf ("</div>\n");
- return 0;
-}
-
-
int main (void)
{
babl_init ();
" padding: 0;"
" margin : 0;"
"}"
- " .cell>a {"
+ ".cell>a {"
" text-decoration: none;"
" color: black;"
" cursor: help;"
"}"
- " .detail {"
+ "div.tooltip {"
" border: 0.2em solid black;"
" padding-top: 1em;"
" padding-right: 2em;"
+ " display: none;"
" padding-left: 2em;"
" padding-bottom: 3em;"
" background-color: white;"
- "}"
- "#tooltip {"
- " position: fixed;"
- " bottom: 0;"
- " right : 0;"
+ " background-repeat: no-repeat;"
+ " background-image: url(graphics/babl-48x48.png);"
+ " background-position: bottom right;"
+ " color: black;"
"}"
" .cell>a:hover {"
" background-color: black;"
" color: white;"
" }"
+ "a:hover>div.tooltip {"
+ " display: block;"
+ " position: fixed;"
+ " bottom: 0;"
+ " right: 0;"
+ "}"
+
"td.component {"
" background-color: #060;"
" padding-left: 0.5em;"
" color: white;"
" border: 1px solid white;"
"}"
+ ".g {"
+ " color: gray;"
+ "}"
+ ".r {"
+ " text-align: right;"
+ "}"
"</style>"
"<script type='text/javascript'>"
"var tick_count=0;"
-"function tick ()"
+"function o ()"
"{"
" tick_count++;"
-" if (tick_count > 42)"
-" alert(\"Clicking doesn't do anything.\");"
+" if (tick_count == 11)"
+" alert(\"«The mind is it's own place,\\nand in itself can make a heaven of hell;\\na hell of heaven.»\\n--Milton\");"
+" else if (tick_count == 42)"
+" alert(\"«So long and thanks for all the fish.»\\n--Adams\");"
"}"
-"function hide (id)"
-"{"
-" (document.getElementById (id)).style.display = \"none\";"
-"}"
-"function show (id)"
-"{"
-" (document.getElementById (id)).style.display = \"block\";"
-"}"
-
"</script>"
printf ("<h1>BablFishPath introspection</h1>");
printf ("<p>The table below represents many of the possible conversions available through babl, (the selection of formats includes all formats that shortcut conversions have been registered for.) </p>");
- printf ("<p>Hover your mouse over a formats name, or a non blank cell on the horizontal line to see further information </p>");
+ printf ("<p>Hover your mouse over a formats name, or a non blank cell on the horizontal line to see further information, both rows and colums represent pixel formats, but only the vertical axis has labels.</p>");
- printf ("<br/><img src='graphics/babl-48x48.png' alt='/babl' />");
printf ( "<table cellspacing='0'>\n");
babl_format_each (table_source_each, NULL);
printf ("</table>");
- printf ("<div id='tooltip'>");
- babl_format_each (detail_source_each, NULL);
- babl_format_each (format_each, NULL);
- printf ("</div>");
-
printf ("<div style='height:20em'></div>\n");
printf ("</body></html>\n");